<template>
    <el-dialog :visible.sync="dialog" :title="isAdd ? '资源审核' : '资源审核'" append-to-body width="450px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px" append-to-body>

            <el-form-item label="是否通过" prop="checkStatus" >
                <el-select v-model="form.checkStatus" clearable  filterable placeholder="请选择是否通过" style="width: 250px;">
                    <el-option
                        v-for="item in codestuas"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>


        </el-form>

        <div slot="footer" class="dialog-footer">
            <el-button type="text" @click="cancel">取消</el-button>
            <el-button :loading="loading" type="primary" @click="doSubmit" >{{btn_title}}</el-button>
        </div>
    </el-dialog>
</template>

<script>
import { topassCheck } from '@/api/request'
export default {
    props: {
        isAdd: {
          type: Boolean,
          required: true
        },
    },
    data() {
        return {
            btn_title:'保存',
            disabled:true,
            loading: false, dialog: false, permissions: [],
            form: {
                id: "",
                checkStatus: 0,
                fromType: 0,
                remark: "",
                resClass: 0,
                resCourses: 0,
                resCover: "",
                resExt: "",
                resFromType: 0,
                resGrade: 0,
                resId: "",
                resName: "",
                resPhases: 0,
                resSize: 0,
                resStatus: 0,
                resType: 0,
                resUrl: "",
                schId: "",
                status: 0,
                storeId: "",
                useType: 0,
                userId: "",
                verId: 0,
                videoDuration: 0
            },
            rules: {
                checkStatus:[
                    { required: true, trigger: 'blur',message: '请选择是否通过',},
                ],
            },
            codestuas:[
                {
                    id: 2,
                    name: '审核通过'
                },
                {
                    id: 3,
                    name: '不通过'
                },
            ]
        }
    },
    methods: {
        cancel(){
            this.dialog  = false
        },
        doSubmit(){
            this.$refs['form'].validate((valid) => {
                if (valid){
                    topassCheck(this.form).then(res=>{
                        this.$notify({
                            title: '提交区域成功',
                            type: 'success',
                            duration: 2500
                        })
                        this.dialog = false
                        this.$parent.init()
                    })
                    
                }else {
                    return false
                }

            })

        },

    },

}
</script>


<style scoped lang="scss">
.el-form-item--mini.el-form-item, .el-form-item--small.el-form-item{
    display: inline-block;
}
</style>
